<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="MySQL.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>显示用户数据</title>
</head>
<body>

	<form name="fm">
		<table width="70%" border="1" cellspacing="0" cellpadding="3">
			<tr>
				<th width="10%">序号</th>
				<th width="20%">姓名</th>
				<th width="20%">登录名</th>
				<th width="20%">电话</th>
				<th width="30%">设置</th>
			</tr>
			<%
				String userId = ""; //
				String userName = ""; //
				String userDlm = ""; //
				String userTel = ""; //

				String sql = "select * from tempUser";
				int i = 0;
				ResultSet rs = stmt.executeQuery(sql);
				
				while (rs.next()) {
					i = i + 1;
					userId = rs.getString("user_id");
					userName = rs.getString("user_name");
					userDlm = rs.getString("user_dlm");
					userTel = rs.getString("user_telephone");
			%>

			<tr>
				<td><input type="checkbox" name="selectUser"
					value="<%=userId%>"><%=i%></td>
				<td><%=userName%></td>
				<td><%=userDlm%></td>
				<td><%=userTel%></td>
				<td><a href="d2018.3.27_userModify.jsp?userId=<%=userId%>">修改</a>&nbsp;&nbsp;<input
					type="button" value="删除" name="btn" onClick="deleteSubmit(<%=userId%>)"></td>
			</tr>
			<%
				}
			%>
		</table>
		<br> <a href="d2018.3.27_userAdd.jsp">添加</a><br> <input type="button"
			name="button" value="批量删除" onClick="deleteMore()">
	</form>
</body>
</html>

<script>
function deleteSubmit(userId){
	var user_id = userId;
	if(!confirm("提示，您是否真的删除此数据？")){
		return;
	}
	window.location.href = "d2018.3.27_userDeleteDo.jsp?userId=" + user_id;
}

function deleteMore(){
	//此处应有验证
	if(!confirm("提示，您是否真的删除此数据？")){
		return;
	}
	document.fm.method = "post";
	document.fm.action = "d2018.3.27_userDeleteDo_pl.jsp";
	document.fm.submit();
	
}
</script>

